package com.github.pig.auth.feign;

import com.github.pig.auth.feign.fallback.AppUserServiceFallbackImpl;
import com.github.pig.common.vo.SysRole;
import com.github.pig.common.vo.SysUserRoleVO;
import com.github.pig.common.vo.UserVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author lengleng
 * @date 2017/10/31
 */
@FeignClient(name = "pig-app-service", fallback = AppUserServiceFallbackImpl.class)
public interface AppUserService {
    /**
     * 通过用户名查询用户、角色信息
     *
     * @param username 用户名
     * @return UserVo
     */
    @GetMapping("/user/findUserByUsername/{username}")
    UserVO findUserByUsername(@PathVariable("username") String username);

    /**
     * 通过手机号查询用户、角色信息
     *
     * @param mobile 手机号
     * @return UserVo
     */
    @GetMapping("/user/findUserByMobile/{mobile}")
    UserVO findUserByMobile(@PathVariable("mobile") String mobile);

    /**
     * 根据OpenId查询用户信息
     * @param openId openId
     * @return UserVo
     */
    @GetMapping("/user/findUserByOpenId/{openId}")
    UserVO findUserByOpenId(@PathVariable("openId") String openId);
    /**
     * 根据qqId查询用户信息
     * @return UserVo
     */
    @GetMapping("/user/findUserByQQId/{qqId}")
    UserVO findUserByQQId(@PathVariable("qqId") String qqId);

    /**
     * 根据roleCode查询角色信息
     * @return UserVo
     */
    @GetMapping("/user/app/{roleCode}")
    SysRole findRoleByRoleCode(@PathVariable("roleCode") String roleCode);

    /**
     * App端新增用户
     * @param userVO
     * @return
     */
    @PostMapping("/user/addAppUser")
    boolean addAppUser(UserVO userVO);

    /**
     * App端新增用户角色
     * @return
     */
    @PostMapping("/user/addAppRole")
    boolean addUserRole(SysUserRoleVO sysUserRoleVO);

}
